package com.schoolvisitors.vo;

import com.schoolvisitors.entity.User;
import com.schoolvisitors.enums.GenderEnum;
import com.schoolvisitors.enums.UserStatusEnum;
import lombok.Data;

import java.time.Instant;
import java.time.LocalDateTime;


@Data
public class UserByManageVo {

    private Long id;
//    private String wechatUserId;
    private String nickname;
    private String realName;

    private String phone;
    private String idNumber;
    private String gender;
    private Long points;
    private String position;
    private Boolean isActive = false;
    private Boolean reservationPermission = false;
    private LocalDateTime createAt;

    private UserStatusEnum status;

    public static UserByManageVo makeUserByManageVo(User user) {
        UserByManageVo userVo = new UserByManageVo();
        userVo.setId(user.getId());
        userVo.setNickname(user.getNickname());
        userVo.setRealName(user.getRealName());
        userVo.setPhone(user.getPhone());
        userVo.setGender(user.getGender().getDesc());
        userVo.setPoints(user.getPoints());
        userVo.setIdNumber(user.getIdNumber());
        userVo.setIsActive(user.getIsActive());
        userVo.setReservationPermission(user.getReservationPermission());
        userVo.setStatus(user.getStatus());
        userVo.setCreateAt(user.getCreateAt());
        userVo.setPosition(user.getPosition());
        return userVo;
    }
}